Deciding Which Protocol to Use
Each of the networking protocols available with Open Transport implements a different set of services. This section provides a brief discussion of the uses of each of the protocols included with the Open Transport system software on the Macintosh computer. If you have Open Transport software modules provided by other vendors than Apple Computer, Inc., you should refer to the documentation that came with that software to determine its use.If you have made provision for the user to select the protocol to be used for communication, you do not need the information in this section. On the other hand, if you are writing an application to perform a specific function, such as to act as a data server, then your choice of protocol or protocols to use depends primarily on your application's needs. In that case, before you open an endpoint, you must make several decisions:
This section discusses each of these choices in turn.
- General purpose or special purpose
- Choice of protocol family
- High-level or low-level protocol
- Connection-oriented or connectionless
- Transaction-based or transactionless
General Purpose or Special Purpose
Your choice of protocol is very simple if there is only one protocol that performs the function you are interested in. For example, if you want to send a print job directly to an AppleTalk printer, you must use the ter Access Protocol (PAP); there is no other choice. On the other hand, if you want to transfer data of a general nature, there are many protocols that can do the job. The following sections describe the factors you can take into consideration to choose among those protocols.Choice of Protocol Family
There are two sets of protocols, or protocol families, included with the Open Transport system software: AppleTalk and TCP/IP. In addition, other developers can provide protocols and protocol families compatible with Open Transport. You must decide which protocol family to use for a specific purpose. For information on the use of other protocols, see the documentation that came with the software.AppleTalk is the proprietary networking technology of Apple Computer, Inc. Every Macintosh computer that has ever been made includes AppleTalk hardware and system software. If your application needs to communicate with other Macintosh computers, AppleTalk is a natural choice. Note that the other computers need not be running Open Transport; the nodes must be running the same protocol, but need not be using the same implementation of the protocol.
TCP/IP, on the other hand, is the standard protocol family used by the Worldwide Internet and by many networks owned by businesses and other organizations. Many networking applications running on Macintosh computers that are not using Open Transport cannot communicate over TCP/IP networks. However, if you wish to communicate with the Worldwide Internet without going through a gateway, or if you want to connect to a network that uses TCP/IP protocols, choose one of the Open Transport TCP/IP protocols.
High-Level or Low-Level Protocol
Figure 1-1 on page 1-9 shows the protocols provided by Apple Computer, Inc. with Open Transport and where they fit in the OSI model. The UDP protocol, which is part of the TCP/IP protocol family, is a connectionless transactionless protocol that provides a minimal amount of error detection in the form of a checksum calculation. If UDP finds that the checksum calculated at any point in the routing process does not match the one calculated when the packet was sent (and stored in the message header), it discards the packet without informing either the sender or receiver of the event.The other high-level protocols shown in Figure 1-1 provide error checking and error recovery services, including checking for correct packet sequence and retransmission of lost or damaged packets.
If you use a high-level protocol that provides for reliable delivery of data and error recovery, you need not implement these services yourself. On the other hand, these protocols generate somewhat more network traffic than the lower-level protocols, including handshake and control signals, signals to maintain sessions, and retransmitted packets.
The network-layer protocols IP and DDP provide best-effort delivery between nodes on a network. They are connectionless protocols and do not correct for corruption of data, packet loss, or incorrect packet sequencing. They generate the least possible amount of network traffic for the data they transmit. These protocols are appropriate for applications that do not require highly accurate data transmission and for applications that provide their own error recovery. If you want to implement your own protocol stack using an AppleTalk or TCP/IP internet, these are the protocols to use.
Connection-Oriented or Connectionless
Connection-oriented protocols ensure reliable delivery of data and do not require you to repeat the recipient's address or repeat the connection process for the duration of the session. Once you have established a connection, the protocol maintains the connection, informing you if it has closed for any reason. Because of the reliability of connection-oriented protocols, they are a good choice whenever you have a lot of data to exchange over a limited period of time. However, in order to maintain the connection, these protocols sometimes send control signals, which result in increased network traffic.Open Transport AppleTalk offers three connection-oriented protocols: ADSP, ASP, and PAP. ADSP is a full-duplex transactionless protocol, well suited to the transfer of large amounts of data. ADSP also includes features that let you authenticate the identity of the party at the other end of the connection and send encrypted data, which is then decrypted at the other end. The authentication and encryption features of ADSP are referred to as AppleTalk Secure Data Stream Protocol (ASDSP).
ASP is a transaction-based protocol, best used to implement workstation applications that require an asymmetrical dialog with a server. ASP provides for the setting up, maintaining, and closing down of a session between a workstation and a server. ASP is a client of ATP.
PAP is a transactionless session-layer protocol and a client of ATP. It is intended primarily for communication with Apple Computer's printer products.
Open Transport TCP/IP provides one connection-oriented protocol, TCP, which is a transactionless protocol. TCP, like ADSP, provides highly reliable data delivery suitable for the transfer of large amounts of data.
Transaction-Based or Transactionless
A transaction-based protocol is well suited to many server-client interactions where the client requests services and there are a limited number of ways in which the server can respond. File servers and printers are examples of servers that can use these protocols.Open Transport AppleTalk includes two transaction-based protocols, ATP
and ASP. ATP is connectionless, and ASP is connection-oriented. ASP is a client of ATP.An ATP transaction request must fit in a single packet; however, the response can contain up to eight packets. ATP transactions are an efficient means of transporting small amounts of data across the network. ATP provides a reliable loss-free transport service.
You should use ATP
A workstation application that requires a state-dependent service should use ADSP or ASP instead of ATP. State dependence means that the response to a request is dependent on a previous request. For example, before a workstation application connected to a file server can read a file, it must have first issued a request to open the file. When a dialog is state dependent, all requests must be delivered in order and duplicate packets must not be sent; ADSP and ASP provide for this.
- if you want to send a small amount of data
- if your application requires delivery of all packets
- if your application can tolerate a minor degree of performance degradation
- if you do not want to incur the overhead and more extensive performance degradation involved in maintaining a session
An ATP transaction-based request, such as a workstation application requesting a server to return the time of day, is independent of other requests and not state dependent.
The Open Transport system software provide by Apple Computer, Inc. does not include any transaction-based protocols for the TCP/IP protocol family.